//---------------------------------------------------------------------------
// a_except.h
//
// alib exception handling stuff
//
// Copyright (C) 2008 Neil Butterworth
//---------------------------------------------------------------------------

#include "a_except.h"
using std::string;

//------------------------------------------------------------------------
// Begin ALib stuff
//------------------------------------------------------------------------

namespace ALib {

//---------------------------------------------------------------------------
// exception with optional message
//------------------------------------------------------------------------

Exception :: Exception( const string & msg )
	: mMsg( msg ),  mFile( "" ), mLine(0) {
}

Exception :: Exception( const string & msg, int line, const string & file )
	: mMsg( msg ), mFile( file ), mLine( line ) {
}

//---------------------------------------------------------------------------
// Do nothing
//---------------------------------------------------------------------------

Exception :: ~Exception() throw() {
}

//------------------------------------------------------------------------
// message as C string via standard what() function
//------------------------------------------------------------------------

const char * Exception :: what() const throw() {
	return mMsg.c_str();
}

//------------------------------------------------------------------------
// as above, but as C++ string
//------------------------------------------------------------------------

const string & Exception :: Msg() const {
	return mMsg;
}

//---------------------------------------------------------------------------
// File name & line number
//---------------------------------------------------------------------------

int Exception :: Line() const {
	return mLine;
}

const string & Exception :: File() const {
	return mFile;
}

//------------------------------------------------------------------------
// end ALib stuff
//------------------------------------------------------------------------


}

// end
